<template>
    <view class="content">
        <text class="success" @click="success">成功</text>
        <text class="error" @click="error">失败</text>
        <text class="warn" @click="warn">警告</text>
        <showToast ref="showToast"></showToast>
    </view>
</template>

<script>
    import showToast from '@/components/showToast/showToast.vue'
    export default {
        components: {
            showToast
          },
        data() {
            return {
                title: 'Hello'
            }
        },
        onLoad() {

        },
        methods: {
            success(){
                this.$refs['showToast'].success('成功');
            },
            error(){
                this.$refs['showToast'].error('失败');
            },
            warn(){
                this.$refs['showToast'].warn('警告');
            }
        }
    }
</script>

<style>
    .content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    text {
        font-size: 36rpx;
        margin-top: 20upx;
        font-size: 30upx;
        color: #fff;
        padding: 15upx 20upx;
    }
    .content .success{
        background-color: #1afa29;
    }
    .content .error{
        background-color: #d81e06;
    }
    .content .warn{
        background-color: #f4ea2a;
    }

</style>